<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="com.example.bean.Person" %><%--
  Created by IntelliJ IDEA.
  User: zhanghz001
  Date: 2020/11/4
  Time: 9:22
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>jstl_homework</title>
</head>
<body>
1、
<hr>
根据已知数据使用jstl标签对数据大小进行判断
<%
    request.setAttribute("aaa", 111);
    request.setAttribute("bbb", 222);
%>
<br>
<c:if test="${aaa>bbb}">
    aaa大
</c:if>
<c:if test="${bbb>aaa}">
    bbb大
</c:if>
<hr>
根据已知数据使用jstl标签判断对象是否为空

<br>
<%

    Person p1 = new Person();

    p1.setName("jack");

    p1.setValue("abcd");

    Person p2 = null;

    request.setAttribute("p1", p1);

    request.setAttribute("p2", p2);

%>
<c:if test="${ empty p1}">
    p1 为空
</c:if>
<br>
<c:choose>
    <c:when test="${ p1 eq null}">
        p1为空
    </c:when>
    <c:when test="${p1 != null}">
        p1不为空
    </c:when>
    <c:otherwise>
        p1
    </c:otherwise>
</c:choose>
<c:choose>

    <c:when test="${ p2 eq null}">
        p2为空
    </c:when>
    <c:when test="${ p2 ne null}">
        p2不为空
    </c:when>
    <c:otherwise>
        p2
    </c:otherwise>
</c:choose>
<hr>
3、

使用jstl标签进行0~10数据偶数的循环遍历输出
<br>
<c:forEach step="2" begin="0" end="10" var="num">
    ${num}
    <br>
</c:forEach>
</body>
</html>
